9 const int MAXSUM
= 200;
10 const int MAXCOINS
= 20;
11 //dp[i][j] = verdadero si puedo repartir las primeras i monedas en dos grupos que difieran en j
12 bool dp
[MAXCOINS
][MAXSUM
+1];
20 memset(dp
, false, sizeof dp
);
27 ++n
, m
.push_back(x
), sum
+= x
;
29 assert(n
== m
.size());
32 for (int i
=1; i
<n
; ++i
){
33 for (int j
=0; j
<=sum
; ++j
){
34 dp
[i
][j
] = dp
[i
-1][abs(j
- m
[i
])];
36 dp
[i
][j
] |= dp
[i
-1][j
+ m
[i
]];
40 cout
<< (dp
[n
-1][0]?"YES":"NO") << endl
;